home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pyr_dirtmover.cog < prev    next >
Text File  |  1999-11-15  |  6KB  |  272 lines

  1. # Jones 3D Cog Script
  2. #
  3. # pyr_dirtmover.cog
  4. #    
  5. # Works for dirtmover in Horner's pit
  6. #
  7. # [RKD] && [PM]
  8. #
  9. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13. message    arrived
  14. message    user1
  15.  
  16. # rotational ghost objects
  17. thing    bottom        linkid=0
  18. thing    topback        linkid=0
  19. thing    topfront    linkid=0
  20. thing    middle        linkid=0
  21.  
  22. # locations to which shovels will be sent from previous rotation
  23. thing    gotopback    nolink
  24. thing    gotopfront    nolink
  25. thing    gomiddle    nolink
  26. thing    gobottom    nolink
  27.  
  28. # shovel items
  29. thing    shovel0        local    # dummy shovel for array
  30. thing    shovel1
  31. thing    shovel2
  32. thing    shovel3
  33. thing    shovel4
  34.  
  35. # variables
  36. int        shovelnum=0        local
  37. int        onbottom=1        local
  38. int        ontopback=2        local
  39. int        ontopfront=3    local
  40. int        onmiddle=4        local
  41. int        shovelat2=0        local
  42. int        shovelat4=0        local
  43. int        shovelat6=0        local
  44. int        shovelat0=0        local
  45.  
  46. thing    shovel0MoveTo    local            // What thing this shovel is currently moving to.
  47. thing    shovel1MoveTo    local
  48. thing    shovel2MoveTo    local
  49. thing    shovel3MoveTo    local
  50. thing    shovel4MoveTo    local
  51.  
  52. thing    shovel0AttachTo    local            // What thing this shovel will next be attached to.
  53. thing    shovel1AttachTo    local
  54. thing    shovel2AttachTo    local
  55. thing    shovel3AttachTo    local
  56. thing    shovel4AttachTo    local
  57.  
  58. flex    shovel0RotateTime        local    // How long the shovel's next rotation will be.
  59. flex    shovel1RotateTime        local
  60. flex    shovel2RotateTime        local
  61. flex    shovel3RotateTime        local
  62. flex    shovel4RotateTime        local
  63.  
  64. int        shovel0RotateDegrees    local    // How many degrees shovel's next rotation will be.
  65. int        shovel1RotateDegrees    local
  66. int        shovel2RotateDegrees    local
  67. int        shovel3RotateDegrees    local
  68. int        shovel4RotateDegrees    local
  69.  
  70. flex    whichShovel                local
  71.  
  72. flex    BottomCycle=2.4            local
  73. flex    UpTime=5.0                local
  74. flex    TopBackCycle=1.2        local
  75. flex    ForeTime=1.0            local
  76. flex    TopFrontCycle=1.8        local
  77. flex    DiagTime=0.779765        local
  78. flex    MiddleCycle=0.6            local
  79. flex    DownTime=3.5            local
  80. flex    Shovel2StartCycle=3.5    local
  81.  
  82. # slow variables, for testing
  83. #flex    BottomCycle=4.8            local
  84. #flex    UpTime=10.0                local
  85. #flex    TopBackCycle=2.4        local
  86. #flex    ForeTime=2.0            local
  87. #flex    TopFrontCycle=3.6        local
  88. #flex    DiagTime=1.55953        local
  89. #flex    MiddleCycle=1.2            local
  90. #flex    DownTime=7.0            local
  91. #flex    Shovel2StartCycle=7        local
  92.  
  93. # subroutines
  94. flex    firstmove=0.0        local
  95. end
  96.  
  97. code
  98. user1:
  99.  
  100. # ---> MoverControl Cog
  101.  
  102.     call firstmove;
  103.     return;
  104.  
  105. #order of shovelsteps
  106. #    0 = attaching to bottom
  107. #    1 = upward from bottom to topback
  108. #    2 = attached to topback
  109. #    3 = inward from topback to topfront
  110. #    4 = attached to topfront
  111. #    5 = diagonally from topfront to middle
  112. #    6 = attached to middle
  113. #    7 = downward from middle to bottom
  114.     
  115. firstmove:
  116. # ---> User1
  117.  
  118.     # starting shovel 1
  119.     AttachThingToThing(shovel1, bottom);
  120.     Rotate(bottom, 180, 0, BottomCycle);
  121.     onbottom = 1;
  122.  
  123.     # starting shovel 2
  124.     MoveThingToPos(shovel2, GetThingPos(gotopback), Shovel2StartCycle);
  125.     shovel2MoveTo = gotopback;
  126.     shovel2AttachTo = topback;
  127.     shovel2RotateTime = TopBackCycle;
  128.     shovel2RotateDegrees = 90;
  129.  
  130.     # starting shovel 3
  131.     AttachThingToThing(shovel3, topback);
  132.     Rotate(topback, 90, 0, TopBackCycle);
  133.     ontopback = 3;
  134.  
  135.     # starting shovel 4
  136.     AttachThingToThing(shovel4, middle);
  137.     Rotate(middle, -45, 0, MiddleCycle);
  138.     onmiddle = 4;
  139.  
  140.     ontopfront = 0;
  141.  
  142.     return;
  143.  
  144. arrived:
  145. # ---> Rotation things
  146.     
  147.     # whatever is attached to bottom wheel, send it toward topback
  148.     if (GetSenderRef() == bottom)
  149.     {
  150.         shovelnum = shovel0[onbottom];
  151.         DetachThing(shovelnum);
  152.         MoveThingToPos(shovelnum, GetThingPos(gotopback), UpTime);
  153.         shovel0MoveTo[onbottom] = gotopback;
  154.         shovel0AttachTo[onbottom] = topback;
  155.         shovel0RotateTime[onbottom] = TopBackCycle;
  156.         shovel0RotateDegrees[onbottom] = 90;
  157.  
  158.         return;
  159.     }
  160.  
  161.     # whatever is attached to topback wheel, send it toward topfront
  162.     if (GetSenderRef() == topback)
  163.     {
  164.         shovelnum = shovel0[ontopback];
  165.         DetachThing(shovelnum);
  166.         MoveThingToPos(shovelnum, GetThingPos(gotopfront), ForeTime);
  167.         shovel0MoveTo[ontopback] = gotopfront;
  168.         shovel0AttachTo[ontopback] = topfront;
  169.         shovel0RotateTime[ontopback] = TopFrontCycle;
  170.         shovel0RotateDegrees[ontopback] = 135;
  171.  
  172.         return;
  173.     }
  174.  
  175.     # whatever is attached to topfront wheel, send it toward middle
  176.     if (GetSenderRef() == topfront)
  177.     {
  178.         shovelnum = shovel0[ontopfront];
  179.         DetachThing(shovelnum);
  180.         MoveThingToPos(shovelnum, GetThingPos(gomiddle), DiagTime);
  181.         shovel0MoveTo[ontopfront] = gomiddle;
  182.         shovel0AttachTo[ontopfront] = middle;
  183.         shovel0RotateTime[ontopfront] = MiddleCycle;
  184.         shovel0RotateDegrees[ontopFront] = -45;
  185.         
  186.         return;
  187.     }
  188.  
  189.     # whatever is attached to middle wheel, send it toward bottom
  190.     if (GetSenderRef() == middle)
  191.     {
  192.         shovelnum = shovel0[onmiddle];
  193.         DetachThing(shovelnum);
  194.         MoveThingToPos(shovelnum, GetThingPos(gobottom), DownTime);
  195.         shovel0MoveTo[onmiddle] = gobottom;
  196.         shovel0AttachTo[onmiddle] = bottom;
  197.         shovel0RotateTime[onmiddle] = BottomCycle;
  198.         shovel0RotateDegrees[onmiddle] = 180;
  199.  
  200.         return;
  201.     }
  202.  
  203.  
  204. # ---> Movement things
  205.  
  206.     if (GetSenderRef() == shovel1)
  207.     {
  208.         whichShovel = 1;
  209.     }
  210.     else
  211.     {
  212.         if (GetSenderRef() == shovel2)
  213.         {
  214.             whichShovel = 2;
  215.         }
  216.         else
  217.         {
  218.             if (GetSenderRef() == shovel3)
  219.             {
  220.                 whichShovel = 3;
  221.             }
  222.             else
  223.             {
  224.                 if (GetSenderRef() == shovel4)
  225.                 {
  226.                     whichShovel = 4;
  227.                 }
  228.                 else
  229.                 {
  230.                     return;
  231.                 }
  232.             }
  233.         }
  234.     }
  235.  
  236.     CopyOrientAndPos(shovel0MoveTo[whichShovel], shovel0[whichShovel]);
  237.  
  238.     # attach and move shovel in question
  239.     AttachThingToThing(shovel0[whichShovel], shovel0AttachTo[whichShovel]);
  240.     Rotate(shovel0AttachTo[whichShovel], shovel0RotateDegrees[whichShovel], 0, shovel0RotateTime[whichShovel]);
  241.  
  242.     if (shovel0AttachTo[whichShovel] == bottom)
  243.     {
  244.         onbottom = whichShovel;
  245.     }
  246.     else
  247.     {
  248.         if (shovel0AttachTo[whichShovel] == topback)
  249.         {
  250.             ontopback = whichShovel;
  251.         }
  252.         else
  253.         {
  254.             if (shovel0AttachTo[whichShovel] == topfront)
  255.             {
  256.                 ontopfront = whichShovel;
  257.             }
  258.             else
  259.             {
  260.                 if (shovel0AttachTo[whichShovel] == middle)
  261.                 {
  262.                     onmiddle = whichShovel;
  263.                 }
  264.             }
  265.         }
  266.     }
  267.  
  268.     return;
  269.  
  270. end
  271.  
  272.